import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import router from 'umi/router';
import {Icon} from 'antd';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import styles from '../Pbulic.less';




@connect(({inspection, global }) => ({
  dictionaries:global.dictionaries,
  detaildata:inspection.detaildata,
}))
export default class EquipmentDetail extends PureComponent {
  constructor(props) {
    super(props);
    this.state={
      tabDefaultKeys:"info",
      detailTitle:null,
    }
  }


  componentDidMount() {

  }

  componentWillUnmount(){
    const { dispatch } = this.props;
    dispatch({
      type: `inspection/appendClearState`,
    })
  }



  goBack = () => {
    // this.props.onClose(0);
    const { dispatch, location, match } = this.props;
    router.push({ pathname:'/inspection/supervise/list',  query: { ...location.query} });
  }

  render() {
    const { match, history, routerData, dictionaries, children} = this.props;

    const location_arry = history.location.pathname.split("/");
    const tabDefaultKeys = location_arry[location_arry.length - 1];
    const detailInfoId = match.params.id;


    // const tabDefaultTitle = [{title:tabList.find(item=>item.key==tabDefaultKeys).tab}];

    return (
      <Fragment>
        <Icon type="close-circle-o"  className={styles.close_icon} onClick={this.goBack}/>
        <PageHeaderLayout
          hiddenBreadcurmb={true}
          title={tabDefaultKeys=='add' ? '发现问题' : tabDefaultKeys=='edit' ? "稽查修改" : "稽查详情"}
        >
          {children}

        </PageHeaderLayout>
      </Fragment>
    );
  }
}
